package com.lb.stream;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.apache.commons.lang3.StringUtils;

import lombok.Data;

/**
 * @author jzhang
 * @version 1.0
 * @date 2022/10/11 17:17
 */
public class ListTest3 {

    public static void main(String[] args) {
        List<Evidence> evidences = new ArrayList() {{
            add(new Evidence("4", "Supporting"));
            add(new Evidence("3", "moderate"));
            add(new Evidence("1", "VeryStrong"));
            add(new Evidence("2", "Strong"));
        }};

        evidences.sort((s1, s2) -> {
            int s11 = s1.hashCode();
            int s22 = s2.hashCode();
            return s11 - s22;
        });

        System.out.println(evidences);

        BigDecimal bd = BigDecimal.valueOf(0.6);
        System.out.println(bd.intValue());
    }

    @Data
    public static class Evidence {
        private String id;
        private String strength;
        private Integer sort;

        public Evidence(String id, String strength) {
            this.id = id;
            this.strength = strength;
        }

        @Override
        public int hashCode() {
            int sort = 0;
            if (StringUtils.equals(strength, "VeryStrong")) {
                sort = 1;
            }
            if (StringUtils.equals(strength, "Strong")) {
                sort = 2;
            }
            if (StringUtils.equals(strength, "moderate")) {
                sort = 3;
            }
            if (StringUtils.equals(strength, "Supporting")) {
                sort = 4;
            }
            return sort;
        }


    }
}
